#!/usr/bin/python
# coding=utf-8
from pymongo import  MongoClient
from elasticsearch import Elasticsearch


shiji_mappings={

}
# 建立到Elasticsearch的连接
_es=Elasticsearch([{'host':'47.92.139.146','port':'9200'}]);
_index_mappings = {
  "mappings": {
    "shiji_ti": {
      "properties": {
        "id":{"type":"string"},
        "grade":     { "type": "text"  },
        "paperyear":      { "type": "text" },
          "papertype": {"type": "text"},
          "paperarea": {"type": "text"},
          "tquestion": {"type": "text"},
          "tanswer": {"type": "text"},
            "tjiexi": {"type": "text"},
            "channel": {"type": "text"},
            "blpaper":{"type":"string"}
      }
    },
    "shiji_paper": {
      "properties": {
        "id":{"type":"string"},
        "papername": {"type": "text"},
        "grade":     { "type": "text"  },
        "paperyear":      { "type": "text" },
          "papertype": {"type": "text"},
          "paperarea": {"type": "text"},
          "channel": {"type": "text"}
      }
    }

  }
}


#if _es.indices.exists(index='shiji21_index') is not True:
#  _es.indices.create(index='shiji21_index', body=_index_mappings)

_es.indices.delete(index='shiji21_index', ignore=400)
_es.indices.create(index='shiji21_index', body=_index_mappings)


